package huawei.exam5;

import java.util.*;

/**
 * @author : Rookie
 * @description :
 * @date : 2023/1/1
 */
public class HJ102 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        Map<Character, Integer> countMap = new TreeMap<>();
        for (int i = 0; i < str.length(); i++) {
            char c = str.charAt(i);
            if (countMap.containsKey(c)) {
                countMap.put(c,countMap.get(c) + 1);
            } else {
                countMap.put(c,1);
            }
        }
        // 将map转为entryList
        List<Map.Entry<Character, Integer>> entryList = new ArrayList<>(countMap.entrySet());
        entryList.sort((o1, o2) -> o2.getValue().compareTo(o1.getValue()));
        entryList.forEach((entry) -> {
            System.out.print(entry.getKey());
        });
    }
}
